﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class AllVariations
{
    static void Main()
    {
        int numberN = 2;
        int numberK = 3;
        int[] array = new int[numberN];
        Permutator(array, numberN, numberK, 0);
    }

    private static void Permutator(int[] array, int numberN, int numberK, int index)
    {
        if (index == numberN)
        {
            Print(array);
            return;
        }
        for (int i = 0; i < numberK; i++)
        {
            array[index] = i + 1;
            Permutator(array, numberN, numberK, index + 1);
        }
    }

    static void Print(int[] array)
    {
        Console.WriteLine();
        for (int i = 0; i < array.Length; i++)
        {
            Console.Write(" " + array[i]);
        }
        Console.WriteLine();
    }

    private static bool CheckIndex(int[] array, int i, int index)
    {
        for (int j = 0; j < index; j++)
        {
            if (array[j] == i)
            {
                return false;
            }
        }
        return true;
    }


}
